/*
 * convert.h
 *
 *  Created on: Jul 24, 2023
 *      Author: 42577
 */

#ifndef DEVICES_CONVERT_H_
#define DEVICES_CONVERT_H_

#include "debug.h"

#define KEY_BOT_UM 1700
#define KEY_HEIGHT 4000
#define KEY_TOP_UM (KEY_BOT_UM + KEY_HEIGHT)

void topbottom2kv(uint16_t top_value, uint16_t bottom_value, float* v0, float* k);
void rescale_kv(float* v0, float* k, int* key_v0, int* key_k);
void key_mm_init(void);

#define adc2height(value, k, v0) k/(value - v0)


#endif /* DEVICES_CONVERT_H_ */
